import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Roll Widget Demo"),
      ),
      body: ListWiewWidget(),
    ),
  ));
}

class ListWiewWidget extends StatelessWidget {


  @override
  Widget build(BuildContext context) {
    Widget divider1 = const Divider(color: Colors.blue,);
    Widget divider2 = const Divider(color: Colors.green,);

    return ListView.separated(

      itemCount: 100,
      //  列表构造器
      itemBuilder: (BuildContext context, int index) {
        return ListTile(title: Text("$index"));
      },
      //  分隔构造器
      separatorBuilder: (BuildContext context, int index){
        return index % 2 == 0 ? divider1 : divider2;
      },
    );
  }
}
